<template>
	<view class="tag" >
		<image v-if="convertTagName== '热卖'" class="tag-name" src="../../../static/svg/Subtracthot.svg"></image>
		<image v-else="convertTagName== '新品'" class="tag-name" src="../../../static/svg/Subtract.svg"></image>
		
	</view>
</template>

<script>
	import Constants from '@/constants';
	//标签组件
	//@group 业务组件
	export default {
		//
		name: 'tag',
		//
		props: {
			//标签名字
			tagName: {
				type: String,
				default: '新品',
				required: true
			},
			//自定义背景色
			customBackground: {
				type: String,
				default: 'linear-gradient(180deg, #FFAF22 0%, #FFBD49 0.01%, #FFA133 100%)',
			}
		},
		//
		data() {
			return {};
		},
		//
		computed: {
			//标签名称，转换逗号格式
			convertTagName() {
				const tageName = this.tagName && this.tagName.split(',') || [];
				return tageName[0] || '新品';
			},
		},
	};
</script>

<style lang="scss" scoped>
	.tag {
		overflow: hidden;
		
		padding: 0rpx 8rpx;
		color: $uni-text-color-inverse;
	}
	.tag-name{
		width: 45rpx;
		height: 35rpx;
	}
</style>